###########################################################
# $Id: xrmake_cmn.mak 4688 2013-01-08 12:24:07Z xrdk $
# brief	    : 
# author    : xrdk
# version   : V1.0, 2004-03-16
#
# CopyRight (C) 2004-2011 xrdk.
# All rights reserved.
###########################################################

XRMK_OBIN   = $(xrmk_dir_bin)
XRMK_OLIB   = $(xrmk_dir_lib)
XRMK_OOBJ   = $(xrmk_dir_obj)
XRMK_ODST   = $(xrmk_dir_dst)

XRMK_GINC   = $(xrmk_sinc) $(xrmk_ginc)
XRMK_GINC_I = $(xrmk_sinc_i) $(xrmk_ginc_i)

XRMK_GLIB   = $(xrmk_slib) $(xrmk_glib)
XRMK_GLIB_L = $(xrmk_slib_l) $(xrmk_glib_l)

XRMK_GDEFS  = $(xrmk_gdefs)
#=====================================================================
#project config:
#XRMK_PNAME  : base name
#XRMK_PCFG   : config name for base name
#XRMK_PFNAME : full name
#XRMK_PDST   : out dst file
#XRMK_PDOUT  : out dir
#XRMK_PDOBJ  : obj dir
#XRMK_PDLIB  : lib dirs
#XRMK_PDINC  : include dirs
#XRMK_PDSRC  : src dirs
#XRMK_PLIB_L : -Llib dirs
#XRMK_PINC_I : -Iinclude dirs
#XRMK_PLIBS  : libs
#XRMK_PDEFS  : defines
#XRMK_PDEF_D : dso defines
#XRMK_PDEF_L : lib defines

XRMK_PCFG     = $(xrmk_cfg)
XRMK_PNAME    =
XRMK_PFNAME   = $(XRMK_PNAME)$(XRMK_PCFG)

XRMK_PDOUT    = $(XRMK_ODST)
XRMK_PDOBJ    = $(XRMK_OOBJ)/$(XRMK_PFNAME)

#XRMK_PDST: XRMK_PDSTDSO XRMK_PDSTLIB XRMK_PDSTEXE
XRMK_PDST     = lib$(XRMK_PFNAME)$(xrmk_ext)

XRMK_PDSTDSO  = lib$(XRMK_PFNAME)$(xrmk_dso_ext)
XRMK_PDSTLIB  = lib$(XRMK_PFNAME)$(xrmk_lib_ext)
XRMK_PDSTEXE  = $(XRMK_PFNAME)$(xrmk_exe_ext)

#=====================================================================
#XRMK_PCC: XRMK_C XRMK_DSO_C XRMK_LIB_C
XRMK_PCC      = $(XRMK_C)

#XRMK_PCPP: XRMK_CPP XRMK_DSO_CPP XRMK_LIB_CPP
XRMK_PCPP     = $(XRMK_CPP)

#XRMK_PLNK: XRMK_DSO_LNK XRMK_DSO_LNKPP
XRMK_PLNK     = $(XRMK_DSO_LNK)

#XRMK_PLD: XRMK_EXE_LD XRMK_EXE_LDPP
XRMK_PLD      = $(XRMK_EXE_LD)

#XRMK_PAR: XRMK_LIB_AR
XRMK_PAR      = $(XRMK_LIB_AR)

#=====================================================================
XRMK_RM_BIN   = -$(xrsh_rm_f) $(XRMK_PDST) $(XRMK_LOGOUT)
XRMK_RM_DST   = -$(xrsh_rm_f) $(XRMK_PDOUT)/$(XRMK_PDST)
XRMK_MV_BIN   = -$(xrsh_mv_f) $(XRMK_PDST) $(XRMK_PDOUT)

XRMK_STR_LNK  = @echo ---- link -- $(XRMK_PDOUT)/$(XRMK_PDST) --
XRMK_END_LNK  = 
XRMK_PRE_LNK  = 
XRMK_POST_LNK = 

#=====================================================================

include $(xrmk_pmak_cmn)

#=====================================================================
VPATH = $(XRMK_GINC) $(XRMK_GLIB) $(XRMK_OOBJ) $(XRMK_ODST) $(XRMK_PDOUT) $(XRMK_PDLIB) $(XRMK_PDOBJ) $(XRMK_PDINC) $(XRMK_PDSRC)

#all include
XRMK_AINC_I   = $(XRMK_GINC_I) $(XRMK_PINC_I)
XRMK_ALIB_L   = $(XRMK_GLIB_L) -L. -Llib -L../lib -Lbin -L../bin -L$(XRMK_ODST) -L$(XRMK_PDOUT) $(XRMK_PLIB_L)

XRMK_ALIBS    = $(xrmk_lib_sys) $(XRMK_PLIBS)

XRMK_LIBPRE   = $(xrmk_lib_pre)
XRMK_LIBSUB   = $(xrmk_lib_sub)
XRMK_CFGSUB   = $(XRMK_PCFG)$(XRMK_LIBSUB)

XRMK_LOGOUT   = $(xrmk_outlog)
XRMK_LOGOBJ   = -o $@ $(XRMK_LOGOUT)
XRMK_LOG      = $(xrmk_log)

XRMK_FLAGS_C   = $(CFLAGS) $(xrmk_flags_c) $(xrmk_opts_debug) $(xrmk_opts_c) $(xrmk_defs) $(XRMK_GDEFS) $(XRMK_PDEFS) $(XRMK_POPTS) $(XRMK_AINC_I)
XRMK_FLAGS_DSO = $(XRMK_FLAGS_C) $(xrmk_flags_dso_c) $(XRMK_PDEF_D)
XRMK_FLAGS_LIB = $(XRMK_FLAGS_C) $(xrmk_flags_lib_c) $(XRMK_PDEF_L)
XRMK_FLAGS     = $(XRMK_FLAGS_C) $(xrmk_flags)

XRMK_C         = $(xrmk_cc) $(XRMK_FLAGS) $(XRMK_LOGOBJ) -c
XRMK_CPP       = $(xrmk_cpp) $(XRMK_FLAGS) $(XRMK_LOGOBJ) -c
XRMK_DSO_C     = $(xrmk_cc) $(XRMK_FLAGS_DSO) $(XRMK_LOGOBJ) -c
XRMK_DSO_CPP   = $(xrmk_cpp) $(XRMK_FLAGS_DSO) $(XRMK_LOGOBJ) -c
XRMK_LIB_C     = $(xrmk_cc) $(XRMK_FLAGS_LIB) $(XRMK_LOGOBJ) -c
XRMK_LIB_CPP   = $(xrmk_cpp) $(XRMK_FLAGS_LIB) $(XRMK_LOGOBJ) -c

XRMK_FLAGS_LNK = $(LDFLAGS) $(xrmk_flags_lnk) $(xrmk_flags_dso_lnk) $(xrmk_opts_lnk) $(XRMK_ALIB_L) $(xrmk_runpath)
XRMK_FLAGS_LD  = $(LDFLAGS) $(xrmk_flags_ld) $(xrmk_opts_lnk) $(XRMK_ALIB_L) $(xrmk_runpath)

XRMK_DSO_LNK   = $(xrmk_lnk) $(XRMK_FLAGS_LNK) -o $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_ALIBS) $(XRMK_LOGOUT)
XRMK_DSO_LNKPP = $(xrmk_lnkpp) $(XRMK_FLAGS_LNK) -o $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_ALIBS) $(XRMK_LOGOUT)
XRMK_EXE_LD    = $(xrmk_ld) $(XRMK_FLAGS_LD) -o $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_ALIBS) $(XRMK_LOGOUT)
XRMK_EXE_LDPP  = $(xrmk_ldpp) $(XRMK_FLAGS_LD) -o $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_ALIBS) $(XRMK_LOGOUT)

XRMK_FLAGS_AR  = $(xrmk_flags_ar)
XRMK_LIB_AR    = $(xrmk_ar) $(XRMK_FLAGS_AR) $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_LOGOUT)

XRMK_AR_X      = $(xrmk_ar) x
XRMK_AR_M      = $(xrmk_ar) cru $(XRMK_PDST) $(XRMK_POBJS) $(XRMK_LOGOUT)
XRMK_RANLIB    = $(xrmk_ranlib)


